/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Daniel Cruz
 */
@Entity
@Table(name = "audiovisual")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Audiovisual.findAll", query = "SELECT a FROM Audiovisual a"),
    @NamedQuery(name = "Audiovisual.findByAudiovisualId", query = "SELECT a FROM Audiovisual a WHERE a.audiovisualId = :audiovisualId")})
public class Audiovisual implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "audiovisual_id")
    private Long audiovisualId;
    @JoinColumn(name = "material_id", referencedColumnName = "material_id")
    @ManyToOne(optional = false)
    private Material materialId;
    @JoinColumn(name = "bat_id_aud_conocimiento", referencedColumnName = "bat_id")
    @ManyToOne(optional = false)
    private BBasicaTipo batIdAudConocimiento;
    @JoinColumn(name = "bat_id_aud_tipo", referencedColumnName = "bat_id")
    @ManyToOne(optional = false)
    private BBasicaTipo batIdAudTipo;

    public Audiovisual() {
    }

    public Audiovisual(Long audiovisualId) {
        this.audiovisualId = audiovisualId;
    }

    public Long getAudiovisualId() {
        return audiovisualId;
    }

    public void setAudiovisualId(Long audiovisualId) {
        this.audiovisualId = audiovisualId;
    }

    public Material getMaterialId() {
        return materialId;
    }

    public void setMaterialId(Material materialId) {
        this.materialId = materialId;
    }

    public BBasicaTipo getBatIdAudConocimiento() {
        return batIdAudConocimiento;
    }

    public void setBatIdAudConocimiento(BBasicaTipo batIdAudConocimiento) {
        this.batIdAudConocimiento = batIdAudConocimiento;
    }

    public BBasicaTipo getBatIdAudTipo() {
        return batIdAudTipo;
    }

    public void setBatIdAudTipo(BBasicaTipo batIdAudTipo) {
        this.batIdAudTipo = batIdAudTipo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (audiovisualId != null ? audiovisualId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Audiovisual)) {
            return false;
        }
        Audiovisual other = (Audiovisual) object;
        if ((this.audiovisualId == null && other.audiovisualId != null) || (this.audiovisualId != null && !this.audiovisualId.equals(other.audiovisualId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Audiovisual[ audiovisualId=" + audiovisualId + " ]";
    }
    
}
